import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlatbasicInfoVO, FlatbasicInfoForm, FlatbasicInfoQuery } from '@/api/zichanguanli/flatbasicInfo/types';

/**
 * 查询公寓基础信息列表
 * @param query
 * @returns {*}
 */

export const listFlatbasicInfo = (query?: FlatbasicInfoQuery): AxiosPromise<FlatbasicInfoVO[]> => {
  return request({
    url: '/zichanguanli/flatbasicInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询公寓基础信息详细
 * @param id
 */
export const getFlatbasicInfo = (id: string | number): AxiosPromise<FlatbasicInfoVO> => {
  return request({
    url: '/zichanguanli/flatrentalInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增公寓基础信息
 * @param data
 */
export const addFlatbasicInfo = (data: FlatbasicInfoForm) => {
  return request({
    url: '/zichanguanli/flatrentalInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改公寓基础信息
 * @param data
 */
export const updateFlatbasicInfo = (data: FlatbasicInfoForm) => {
  return request({
    url: '/zichanguanli/flatbasicInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除公寓基础信息
 * @param id
 */
export const delFlatbasicInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/flatbasicInfo/' + id,
    method: 'delete'
  });
};
